package com.atguigu.ssyx.acl.controller;

import com.atguigu.ssyx.common.result.Result;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 杨林
 * @create 2023-07-05 9:19 星期三
 * description:
 */
@RestController
@RequestMapping("/admin/acl/index")
@CrossOrigin   //解决跨域问题
public class IndexController {

    /**
     * 登录接口
     * @return
     */
    @PostMapping("/login")
    public Result login(){
        Map<String,Object> map = new HashMap<>();
        map.put("token","admin-token");
        return Result.ok(map);
    }


    /**
     * 获取用户信息
     * @return
     */
    @GetMapping("/info")
    public Result getUserInfo(){
        Map<String,Object> map = new HashMap<>();
        map.put("name","向上吧，少年");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    /**
     * 退出登录
     * @return
     */
    @PostMapping("/logout")
    public Result logout(){
        return Result.ok();
    }
}
